package com.qihoo.finance.lcs;

import org.junit.Test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TimeStampCalculator {

    @Test
    public void test_parse_date_to_timestamp() throws ParseException {
        String dateStr = "2020-09-03 06:00:00";
        System.out.println(dateStr);
        Long timeStamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(dateStr).getTime();
        System.out.println(timeStamp);
    }

    @Test
    public void test_parse_timestamp_to_date(){
        long timeStamp = 1599014003000L;
        String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(timeStamp));
        System.out.println(date);
    }

}
